import requests
import app


class EmployeeAPI:

    def __init__(self):
        self.url_insert = app.BASE_URL + "/api/sys/user"
        self.url_other = app.BASE_URL + "/api/sys/user/{}"

    def insert_staff(self, insert_data, token):
        return requests.post(url=self.url_insert, json=insert_data, headers={"Authorization": token})

    def select_staff(self, staff_id, token):
        return requests.get(url=self.url_other.format(staff_id), headers={"Authorization": token})

    def update_staff(self, staff_id, update_data, token):
        return requests.put(url=self.url_other.format(staff_id), json=update_data, headers={"Authorization": token})

    def delete_staff(self, staff_id, token):
        return requests.delete(url=self.url_other.format(staff_id), headers={"Authorization": token})
